package com.qf.utils;

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class JedisPoolUtil {
    private static JedisPool jedisPool =null;
        private static String host ="10.31.162.13";
        private static int port = 6379;
        private static int timeOut = 3000;
        private static String password="123";

    static {
        GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    jedisPool = new JedisPool(poolConfig,host,port,timeOut,password);

    }
    public static Jedis getJedis(){
        return jedisPool.getResource();
    }
    public static void close(Jedis jedis){
      jedis.close();
    }

}
